Understanding the objects in the API

All of the custom functions in the following sections are methods of the dreamweaver object, the site object, or the object that represents a document's DOM. Methods that fit into the latter category are listed here as dom.functionName(). To produce the desired results, you must first get the DOM of a document and call the functions as methods of that DOM. You cannot simply type dom.functionName(). For example:

var currentDOM = dreamweaver.getDocumentDOM('document');
currentDOM.setSelection(100,200);
currentDOM.clipCopy();
var otherDOM = dreamweaver.openDocument(dreamweaver.getSiteRoot() + "html/foo.htm");
otherDOM.endOfDocument();
otherDOM.clipPaste();

Unless otherwise noted, methods of the dom object can only operate on open documents, and running a function on a document that isn't open will cause Dreamweaver to report an error. Methods of the dom object that can operate only on the active document or on closed documents indicate this fact in their descriptions.

In Dreamweaver 3, dw is synonymous with dreamweaver. Thus all of the methods of the dreamweaver object can be referred to as dw.functionName(). This notation appears in code examples throughout this and following chapters.